import request from "./request";
import type {
  submitXinGuanDataType,
  wxLoginDataType,
} from "@/tsDataType/dataType";

//获取首页接口数据
export const getHomeApi = () => {
  return request({
    url: "frontpage",
    method: "GET",
  });
};

//获取新冠疫苗预约时段信息
export const getNewapptimeApi = () => {
  return request({
    url: "newapptime",
    method: "GET",
  });
};

//提交新冠预约api
export const submitXinGuanYuYueApi = (data: submitXinGuanDataType) => {
  return request({
    url: "rescovid",
    method: "POST",
    data,
  });
};

//登录接口
export const wxLoginApi = (data: wxLoginDataType) => {
  return request({
    url: "wx_login",
    method: "POST",
    data,
  });
};

//新冠疫苗预约订单api
export const coviduserOrderApi = () => {
  return request({
    url: "coviduser_order",
    method: "GET",
  });
};

//取消新冠疫苗预约订单预约
export const covidcancelApi = (_id: string) => {
  return request({
    url: "covidcancel",
    method: "GET",
    data: { _id },
  });
};

//HPV疫苗列表
export const hpvListApi = () => {
  return request({
    url: "otuhpv",
    method: "GET",
  });
};

//获取hpv套餐接口
export const hpvTaoCanLisApi = () => {
  return request({
    url: "hpv_pack",
    method: "GET",
  });
};

//查询套餐价格接口
interface optionsDataPrice {
  hpv_id: string;
  combo_id: string;
  time_id: string;
}
export const getComBoPriceApi = (data: optionsDataPrice) => {
  return request({
    url: "hpv_price",
    method: "POST",
    data,
  });
};

//提交HPV疫苗预约
interface submitHpvData {
  name: string;
  //身份证
  id_card: string;
  //性别
  gender: string;
  //出生日期
  born_date: string;
  //电话
  phone: string;
  combo: string;
  ino_time: string;
  price: number;
  hpv_name: string;
}
export const submitHpvApi = (data: submitHpvData) => {
  return request({
    url: "reshpv",
    method: "POST",
    data,
  });
};

//获取就诊人信息
export const getPatientInfoApi = () => {
  return request({
    url: "get_patient",
    method: "GET",
  });
};

//添加新的就诊人
interface addPatientDataType {
  name: string;
  sex: string;
  born: string;
  relation: string;
  id_card: string;
  phone: string;
}
export const addPatientApi = (data: addPatientDataType) => {
  return request({
    url: "patient_res",
    method: "POST",
    data,
  });
};

//提交就诊人
interface submitPatient {
  illness: string;
  guide: boolean;
  ins_report: string[];
  patient_id: string;
}
export const submitPatientApi = (data: submitPatient) => {
  return request({
    url: "graphics",
    method: "POST",
    data,
  });
};
